interface Goods {
  readonly id: number;
  name: string;
  price: number;
  description?: string;
  [key: number]: string;
}

const goods: Goods = {
  id: 1,
  name: "iphone",
  price: 8888,
  0: "0",
  // hh: '312' // 报错
};

// goods.id = 2 // 报错

interface ReseponseData<T> {
  code: number;
  data: T;
  message?: string;
}

const r1: ReseponseData<string> = {
  code: 200,
  data: "123",
};

const r2: ReseponseData<{ name: string, age: number }> = {
  code: 200,
  data: { name: '123', age: 12 },
  message: 'success'
};